import log from '@dfeidao/atom-nodejs/logger/log';
import { systemid } from '../../atom/config';
import operate from '@dfeidao/atom-nodejs/db/operate';

interface Message {
	filter: {
		client_no: string;
		contact: string;
		contact_number: string;
		wechat_no: string;
		mail_box: string;
		qq: string;
		img_url: string;
	};
}

export default async function atom(msg: Message, action_id: string, session_id: string) {
	log('Service begin');
	// todo
	const { insert, exec } = operate(action_id, session_id, systemid);
	insert('contact', { client_no: msg.filter.client_no, contact: msg.filter.contact, contact_number: msg.filter.contact_number, mail_box: msg.filter.mail_box, wechat_no: msg.filter.wechat_no, qq: msg.filter.qq, img_url: msg.filter.img_url });
	const res = await exec();
	log('Service end');
	return res;
}
